/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       window_background.h

	$Header: /game/window_background.h $

	$NoKeywords: $

 ************************************************************************/
#ifndef WINDOW_BACKGROUND_H_INCLUDED
#define WINDOW_BACKGROUND_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "cached_ptr.h"
#include "game_window.h"

class t_button;
class t_dialog_box_cache;
class t_dialog_box_bitmaps;

// ----------------------------------------------------------------
// window background: fills specified area with bitmaps
// ----------------------------------------------------------------
class t_window_background : public t_window
{
public:
	t_window_background( t_cached_ptr<t_dialog_box_bitmaps> const& bitmaps,
		                 t_window* parent );
	t_window_background( t_cached_ptr<t_dialog_box_bitmaps> const& bitmaps,
		                 t_screen_rect const& rect, t_window* parent );

	void         add_close_button( t_button*, int result );
	void         close_click( t_button* button ); // close box, no result.
	void         close_click_result( t_button* button, int result ); // close with a result
	int          get_bottom_border() const;
	int          get_left_border() const;
	int          get_right_border() const;
	int          get_top_border() const;
	void	     open_around( t_screen_rect const& rect );
protected:
	void construct();
	void init( t_screen_rect const& rect );

private:
	t_cached_ptr<t_dialog_box_bitmaps>  m_bitmaps;
	t_screen_rect						m_border_extents;
	t_screen_rect						m_margin;
};

typedef t_counted_ptr<t_window_background> t_window_background_ptr;

inline int t_window_background::get_bottom_border() const
{
	return m_margin.bottom;
}

inline int t_window_background::get_left_border() const
{
	return m_margin.left;
}

inline int t_window_background::get_right_border() const
{
	return m_margin.right;
}

inline int t_window_background::get_top_border() const
{
	return m_margin.top;
}

#endif // WINDOW_BACKGROUND_H_INCLUDED